Skip to main content

Background

Objective

gem5 is a system simulator that models CPUs at the microarchitecture level and all associated structures such as caches, memory and interconnect buses. It implements many architectural features that will be studied this term. The purpose of this assignment is to get acquainted with gem5 and with the methodology for running simulations to estimate the performance of machines.

About gem5

gem5 allows the simulation of a wide range of CPUs, both functionally (correctness only) and for timing (correctness and efficiency). It supports multiple ISAs, including x86-64 and ARM. For this course, gem5 has been compiled on the undergraduate lab machines to run RISC-V binaries. The RISC-V architecture has been adopted in several markets due to its power efficiency and open standards, seeing use in a variety of settings.

A significant amount of reading is required to get acquainted with gem5. To complement the existing gem5 documentation --- or to clarify in situations where the documentation is out of date --- the source code is available and should be analyzed.

info

A Tutorials page should help understand the system. The official gem5 documentation gives a high-level understanding of how gem5 works. The instructions are specific for gem5 running the environment used for CMPUT 429.

The assignment

gem5 can simulate CPUs with different configurations (e.g. number of cores, pipeline complexity, cache size...) based on configuration scripts. The resources repository contains the script scripts/SiFiveP550/SiFiveP550.py, that implements a single-core SiFive P550 processor. Your task is to update this script to reflect the characteristics of a single-core SiFive P650 processor (the actual parts that need to be set will be explained in the next section). The modified simulator should then run the mcf_r benchmark from the SPEC CPU2017 suite, analyze the results of this simulation and answer questions.

Supplementary Activity

Read on the differences between P550 and P650 processors. This might be a good place to start.

This assignment is to be completed by a pair of students. Please turn in a single report per pair and remember to put both partner names on the report.

Important!

Students must work on the assignment as a group, this means that students should make a collaborative effort to solve the problems in the assignment together. More about the collaboration requirements can be found in the Collaboration page.

Simulation-Time Estimation

Is is useful to know how long such a simulation is expected to run, in case something goes wrong with your simulation. During the Summer of 2024, running on an idle machine, the simulation above took roughly 10.5 minutes to complete.


This lab exercise was created by Taylor Lloyd for Dr. J Nelson Amaral, with inspiration from lab exercises created by Jean-Loup Baer and his team at the University of Washington. It was refactored by Rodolfo Wottrich in April/2016 based on student feedback and modified in 2024 to reflect the course change to the RISC-V ISA by Ayrton Chilibeck.